//app.js
const ald = require('./utils/ald-stat.js') ;

//小神推
const xst_app = require('./utils/pushsdk.js').pushSdk(App, 'App').App;
const xst_page = require('./utils/pushsdk.js').pushSdk(Page).Page;
App({
  onLaunch: function (options) {
    // 展示本地存储能力
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 获取系统信息
    wx.getSystemInfo({
      success: res => {
        this.phoneInfo.ratio = 750 / res.windowWidth;
      } 
    });
    if (options.path !== 'pages/student/index/index') {
      wx.redirectTo({
        url: options.path
      });
    }
  },
  onShow: function () {
    let that = this;
    wx.getSystemInfo({
      success: res => {
        let modelmes = res.model;
        if (modelmes.search('iPhone X') != -1) {
          that.globalData.isIphoneX = true
        }
      }
    })
  },
  globalData: {
    url: 'https://zsy.api.oucnet.com/adapi.php?',
    //邀请参数
    enterpriseId: '',
    refId: '',
    // userId: '',
    idNumber: '',
    isIphoneX: false
  },
  phoneInfo: {
    ratio: 0
  },
  tabBar: [{
    "pagePath": "/pages/student/index/index",
    "text": "小课堂",
    "iconPath": "/images/ico_3.png",
    "selectedIconPath": "/images/ico_4.png"
  },
  {
    "pagePath": "/pages/welcome/applydesc/applydesc",
    "text": "我的",
    "iconPath": "/images/ico_1.png",
    "selectedIconPath": "/images/ico_2.png"
  }],
  tabBarGw:[{
    "pagePath": "/pages/student/index/index",
    "text": "分享小课堂内容"
  }]
})